﻿﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>" />
<title>无标题文档</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="static/css/style.css" rel="stylesheet" type="text/css" />
<link href="static/layui/css/layui.css" rel="stylesheet" type="text/css" />
<link href="static/css/bootstrap-3.3.7.css" rel="stylesheet" type="text/css" />
<link href="static/css/hui-icon/1.0.7/iconfont.css" rel="stylesheet" type="text/css" />
 <style type="text/css">  
 /*设置内容超出用省略号代替*/
 .tablelist {  
    table-layout: fixed;  
    width: 98% border:0px;  
    margin: 0px;  
} 
 .tablelist tr td {  
    text-overflow: ellipsis; /* for IE */  
    -moz-text-overflow: ellipsis; /* for Firefox,mozilla */  
    overflow: hidden;  
    white-space: nowrap;   
    text-align: left  
}  
 </style>


</head>


<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="user/right">首页</a></li>
    <li><a href="#">数据表</a></li>
    <li><a href="#">基本内容</a></li>
    </ul>
    </div>
    
    <div class="rightinfo">
    
    <form id="pDetailForm" name="pDetailForm" action="purchase/list" method="post" class="layui-form">
       
       <div class="tools">
       <div class="text-c mt-20">

            <div class="layui-input-inline">
                  <select id="isStorage" name="isStorage">
                      <option value="">是否入库-不限制</option>
                      <option value="1">已入库</option>
                      <option value="0">未入库</option>
                  </select>
            </div>

            <a  class="btn btn-success radius" onclick="query();">搜索</a>
            <button  class="btn btn-primary radius" type="reset">重置</button>

        </div>
    </div>
    
    <div class="mt-20">
    <table class="tablelist">
    	<thead>
    	<tr>
        <th style="width: 200px;text-align: center;">编号<i class="sort"><img src="static/images/px.gif" /></i></th>
        <th style="width: 200px;text-align: center;">创建人</th>       
        <th style="width: 200px;text-align: center;">是否入库</th>
        <th style="width: 300px;text-align: center;">创建时间</th>
        <th style="text-align: center;">操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${page.records}" var="p">
        <tr>
        <td style="text-align: center;">${p.id}</td>
        <td style="text-align: center;">${p.user.name}</td>       
        <td style="text-align: center;">
            <c:choose>
                <c:when test="${p.isStorage == 1}"><span class="label label-success"> 已入库 </span></c:when>
                <c:otherwise><span class="label label-danger"> 未入库 </span></c:otherwise>
            </c:choose>   
        </td>
        <td style="text-align: center;">${p.createTime}</td>     
        <td style="text-align: center;">
        <a onclick="del(${user.id});" title="删除" class="tablelink"><i class="Hui-iconfont">&#xe6e2;</i></a>
       	</td>
        </tr> 
        </c:forEach>   
        </tbody>
    </table>
    </div>
    </form>
    
    </div>
    
<script language="javascript" src="static/js/jquery.min.js"></script>
<script src="static/layer/layer.js" charset="utf-8"></script>
<script src="static/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript">


	layui.use([ 'element', 'laydate', 'form' ], function() {
		var laydate = layui.laydate;
		var form = layui.form();
		var element = layui.element();
	});

	$(document).ready(function() {
		$(".click").click(function() {
			$(".tip").fadeIn(200);
		});

		$(".tiptop a").click(function() {
			$(".tip").fadeOut(200);
		});

		$(".sure").click(function() {
			$(".tip").fadeOut(100);
		});

		$(".cancel").click(function() {
			$(".tip").fadeOut(100);
		});

	});

	$('.tablelist tbody tr:odd').addClass('odd');
</script>
<script type="text/javascript">

  function query(){
	  $('#pDetailForm').submit();
  }

  function openAddView(){
      layer.open({
          type: 2,
          title:'新增用户',
          closeBtn: 2,
          area: ['80%', '85%'],
          shadeClose: true,
          shade: 0.5,
          anim: 2,
          content: 'user/openAddView', //iframe的url，no代表不显示滚动条
          success: function (layero, index) {
            var body = layer.getChildFrame('body', index);
            var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();

          },
          end: function () {

          }

        });
  }

  
  
  function del(id){
	  layer.confirm('确定删除吗？',{icon: 3, title:'提示'},function(index){
		  layer.close(index);
		  $.post('user/delete',{'id':id},function(result){
			  if(null != result.code && result.code >= 1){
				  layer.alert('删除成功',function(){
					  window.location.reload();
				  });
			  }
		  },'json');
	
	  });
  }
  
</script>

</body>

</html>
